package com.kancy.stream.rabbit.handler;

import com.kancy.stream.rabbit.message.ChannelMessage;

/**
 * MessageHandler
 *
 * @author kancy
 * @date 2020/3/8 10:18
 */
public interface MessageHandler<T> {
    /**
     * 监听消息
     * @param message
     * @throws Exception
     */
    default void onMessage(ChannelMessage<T> message) {
        onMessage(message.getPayload());
    }

    /**
     * 监听消息
     * @param payload
     * @throws Exception
     */
    default void onMessage(T payload) {

    }
}
